<div id="clients">
  <div>
    <div>当前链接用户</div>
    <div>
      <table>
        <thead>
          <tr>
            <th>app</th>
            <th>id</th>
            <th>操作</th>
          </tr>
        </thead>
        <tbody>
          <tr v-for="item in clients" :key="item.id">
            <td>{{ item.id }}</td>
            <td>{{ item.type }}</td>
            <th>发送消息</th>
          </tr>
        </tbody>
      </table>
    </div>
  </div>
</div>
<script>
    
createApp({setup() {
  const clients = ref([]);

    const ws = io(`http://localhost:3002/getClients`, {
      transports: ['websocket']
    });
      ws.on("connect", () => {
      console.log("连接成功，id："+ws.id);
      status.value = "ws连接成功";
    });


  const syncClients = async () => {
    const { data } = await axios.get("/ws/clients");
    console.log(222, data.data);
    clients.value = data.data;
  };
  syncClients();

  console.log(clients);
  return { clients, };
},}).mount("#clients");
</script>
